﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
namespace jogoLudumdare
{
    class Menu : State
    {
        Texture2D Fundo;
        public static Itens BtnCreditos, BtnIniciar, BtnInstrucoes, BtnSair;
        //Texture2D Fundo, BtnCreditos, BtnIniciar, BtnInstrucoes, BtnSair;
         // 1 Portugues  /  2 Inglês
        Vector2[] BtnPosicoes = new Vector2[5];
        int Largura = 46;
        int Altura = 193;
        Texture2D BtIniciarING, BtinstING, BtCreditING, BtSairING;
        Texture2D BtIniciarPORT, BtinstPORT, BtCreditPORT, BtSairPORT;


        public Menu(ContentManager content)
        {
            //Idioma = 1;
            Fundo = content.Load<Texture2D>(@"Menu/Ingles/Menu");

                    BtIniciarPORT =content.Load<Texture2D>(@"Menu/Portugues/iniciar");
                    BtinstPORT = content.Load<Texture2D>(@"Menu/Portugues/instrucoes");
                    BtCreditPORT =content.Load<Texture2D>(@"Menu/Portugues/creditos");
                    BtSairPORT = content.Load<Texture2D>(@"Menu/Portugues/sair");

                    BtIniciarING = content.Load<Texture2D>(@"Menu/Ingles/iniciar");
                    BtinstING = content.Load<Texture2D>(@"Menu/Ingles/instrucoes");
                    BtCreditING =content.Load<Texture2D>(@"Menu/Ingles/creditos");
                    BtSairING =content.Load<Texture2D>(@"Menu/Ingles/sair");

                    BtnIniciar = new Itens(BtIniciarING, new Vector2(10, 200));
                    BtnInstrucoes = new Itens(BtIniciarING, new Vector2(10, 200 + (Largura * 1)));
                    BtnCreditos = new Itens(BtCreditING, new Vector2(10, 200 + (Largura * 2)));
                    BtnSair = new Itens(BtSairING, new Vector2(10, 200 + (Largura * 3)));

                   
            }
            
        


        public void MouseEmCima(SpriteBatch spriteBatch, MouseState mouse)
        {
            if (mouse.X > BtnIniciar.Position.X && mouse.X < BtnIniciar.Position.X + BtnIniciar.Imagem.Width &&
              mouse.Y > BtnIniciar.Position.Y && mouse.Y < BtnIniciar.Position.Y + BtnIniciar.Imagem.Height &&
              mouse.LeftButton == ButtonState.Pressed)
            {

                nextState = GameState.Intro;
                
            }


            if (mouse.X > BtnInstrucoes.Position.X && mouse.X < BtnInstrucoes.Position.X + BtnInstrucoes.Imagem.Width &&
              mouse.Y > BtnInstrucoes.Position.Y && mouse.Y < BtnInstrucoes.Position.Y + BtnInstrucoes.Imagem.Height &&
              mouse.LeftButton == ButtonState.Pressed)
            {

                nextState = GameState.Instrucoes;
            }


            if (mouse.X > BtnCreditos.Position.X && mouse.X < BtnCreditos.Position.X + BtnCreditos.Imagem.Width &&
              mouse.Y > BtnCreditos.Position.Y && mouse.Y < BtnCreditos.Position.Y + BtnCreditos.Imagem.Height &&
              mouse.LeftButton == ButtonState.Pressed)
            {

                nextState = GameState.Credits;
            }


            if (mouse.X > BtnSair.Position.X && mouse.X < BtnSair.Position.X + BtnSair.Imagem.Width &&
              mouse.Y > BtnSair.Position.Y && mouse.Y < BtnSair.Position.Y + BtnSair.Imagem.Height &&
              mouse.LeftButton == ButtonState.Pressed)
            {

                nextState = GameState.Exit;
            }
        }

        public void Draw(SpriteBatch spriteBatch, MouseState mouse)
        {
            
            spriteBatch.Draw(Fundo, Vector2.Zero, Color.White);

            spriteBatch.Draw(BtnIniciar.Imagem, BtnIniciar.Position, Color.White);
            spriteBatch.Draw(BtnInstrucoes.Imagem, BtnInstrucoes.Position, Color.White);
            spriteBatch.Draw(BtnCreditos.Imagem, BtnCreditos.Position, Color.White);
            spriteBatch.Draw(BtnSair.Imagem, BtnSair.Position, Color.White);

            MouseEmCima(spriteBatch, mouse);

        }

        public void Update(GameTime gameTime)
        {
            if (Game1.IdiomaAtual == Game1.EstadoIdioma.Ingles)
            {
                BtnIniciar.Imagem = BtIniciarING;
                BtnCreditos.Imagem = BtCreditING;
                BtnInstrucoes.Imagem = BtinstING;
                BtnSair.Imagem = BtSairING;

            }
            if (Game1.IdiomaAtual == Game1.EstadoIdioma.Portugues)
            {
                BtnIniciar.Imagem = BtIniciarPORT;
                BtnCreditos.Imagem = BtCreditPORT;
                BtnInstrucoes.Imagem = BtinstPORT;
                BtnSair.Imagem = BtSairPORT;
            }
        }

    }
}
